package com.forage.exp.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.forage.exp.mapper.ContentMapper;
import com.forage.exp.po.Content;
import com.forage.exp.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.iceclean.logtrace.annotation.EnableLogTrace;

import java.util.List;
import java.util.logging.Logger;

/**
 * @author : Ice'Clean
 * @date : 2022-05-12
 */
@Service
@EnableLogTrace
public class ContentServiceImpl implements ContentService {

    @Autowired
    private ContentMapper contentMapper;

    Logger logTrace;

    @Override
    public List<Content> getContentByKind(int kindId, int page, int num) {
        return contentMapper.selectPage(
                new Page<>(page, num),
                new LambdaQueryWrapper<Content>().eq(Content::getKindId, kindId))
                .getRecords();
    }
}
